<%@page import="java.util.Map"%>
<%@page import="java.util.ArrayList"%>
<%@page import="goomi.calendar.calendarService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
calendarService cal = new calendarService();
ArrayList cals = cal.getCalendar("all");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>Insert title here</title>
<script type="text/javascript">

function addCal(){
	$('#orderForm').each(function(){
        this.reset();
	});
	$('#custDiv').show();
}

$(document).ready(function() {
	$( "#date" ).datepicker();
	$( "#date" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
	$( "#custDiv" ).hide();
	$('#custBut').button().click(function(){
		addCal();
	});
	$('#upload').hide();
	
	$('#submit').button().click(function (){
		$('#orderForm').submit();
		alert("新增完成");
		$('#d6').load("jsp/GoomiFamily/goomiFamily3.jsp");
	});
});


</script>
</head>
<body>
<% if("admin".equals(session.getAttribute("type"))){ %>
<button id=custBut>新增</button>
<% } %>
<div id=custDiv>
	<form id='orderForm' target="upload" action="/Goomi/Ajax.template">
		<input type="hidden" id=action name=action value="edit" />
		<input type="hidden" id=table name=table value="`calendar`" />
		<input type="hidden" id=oper name=oper value="add" />
		<input type="hidden" id=member_id name=member_id value="<%=session.getAttribute("id") %>" />
		<input type="hidden" id=id name=id value="_empty" />
		
		日期:<br><input type="text" id="date" name="date" value="">
		<br>內容:<br><textarea id="content" name="content" cols="100" rows="10"></textarea>
		<button id='submit'>送出</button> 
	</form>
	 <iframe id="upload" frameborder="0" onchange="alert(123);"></iframe>
</div>

<table>
<%
for(int i = 0 ; i < cals.size() ; i++){
	Map item = (Map)cals.get(i);
%>
<tr>
<td valign="top"><%=item.get("date") %></td>
<td valign="top"><pre><%=item.get("content") %></pre></td>
</tr>
<%
}
%>
</table>
</body>
</html>